package com.chapter2.sort;

/** 
 * @ClassName: AbstractSort 
 * @Description:  排序抽象类
 * @author minjun minjun@bw30.com
 * @date 2015-2-13 下午10:59:14 
 *  
 */
public abstract class AbstractSort extends SwapImpl implements Sortable{

	@Override
	public abstract void sort(int[] array);

	@Override
	public void print(int[] array) {
		for(int a:array){
			System.out.print(a+"\t");
		}
	}

	@Override
	public boolean less(int a, int b) {
		return a<b;
	}
	
	@Override
	public boolean isSorted(int[] array) {
		for(int i=1;i<array.length;i++){
			if(less(array[i], array[i-1])){
				System.out.println(array[i]);
				return false;
			}
		}
		return true;
	}
}
